<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/astronaut32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/astronaut16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="fonts.googleapis.com/css?family=EB Garamond:300,300italic,400,400italic,700,700italic|Cinzel Decorative:300,300italic,400,400italic,700,700italic|Noto Serif SC:300,300italic,400,400italic,700,700italic|Source Code Pro:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-pace-theme-minimal.min.css">
  <script src="/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"fat_fat_where_are_you.gitee.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":false,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500&display=swap" rel="stylesheet">
  <meta name="description" content="JavaScript基础语法1 这篇主要讲了JavaScript的基础知识和变量和数据类型这是初学者写下的笔记，如有错误，欢迎前来指正！">
<meta property="og:type" content="article">
<meta property="og:title" content="JavaScript 基础语法 1">
<meta property="og:url" content="http://fat_fat_where_are_you.gitee.io/archives/5606f168.html">
<meta property="og:site_name" content="肥肉啊肥肉你在哪">
<meta property="og:description" content="JavaScript基础语法1 这篇主要讲了JavaScript的基础知识和变量和数据类型这是初学者写下的笔记，如有错误，欢迎前来指正！">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-08-04T07:06:37.000Z">
<meta property="article:modified_time" content="2020-08-04T07:06:37.000Z">
<meta property="article:author" content="肥肉啊肥肉你在哪">
<meta property="article:tag" content="JavaScript">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://fat_fat_where_are_you.gitee.io/archives/5606f168.html">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<link rel="stylesheet" type="text/css" href="/css/injector/main.css"><link rel="preload" as="style" href="/css/injector/light.css"><link rel="preload" as="style" href="/css/injector/dark.css">
  <title>JavaScript 基础语法 1 | 肥肉啊肥肉你在哪</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">肥肉啊肥肉你在哪</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-movies">

    <a href="/movies/" rel="section"><i class="fa fa-film fa-fw"></i>观影</a>

  </li>
        <li class="menu-item menu-item-books">

    <a href="/books/" rel="section"><i class="fa fa-book fa-fw"></i>阅读</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" placeholder="搜索..." spellcheck="false" type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://fat_fat_where_are_you.gitee.io/archives/5606f168.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/touxiang.gif">
      <meta itemprop="name" content="肥肉啊肥肉你在哪">
      <meta itemprop="description" content>
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="肥肉啊肥肉你在哪">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          JavaScript 基础语法 1
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-08-04 15:06:37" itemprop="dateCreated datePublished" datetime="2020-08-04T15:06:37+08:00">2020-08-04</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index"><span itemprop="name">前端</span></a>
                </span>
            </span>

          
          
          <br>
            <span id="/archives/5606f168.html" class="post-meta-item leancloud_visitors" data-flag-title="JavaScript 基础语法 1" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/archives/5606f168.html#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/archives/5606f168.html" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>3.3k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>3 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="JavaScript 基础语法 1"><a href="#JavaScript 基础语法 1" class="headerlink" title="JavaScript 基础语法 1"></a>JavaScript 基础语法 1</h1><blockquote>
<p>这篇主要讲了 JavaScript 的基础知识和变量和数据类型 <br> 这是初学者写下的笔记，如有错误，欢迎前来指正！</p>
</blockquote>
<span id="more"></span>

<ul>
<li>JavaScript 不再是标记语言啦，是一个编程语言！</li>
</ul>
<h2 id="JavaScript-Hello-World"><a href="#JavaScript-Hello-World" class="headerlink" title="JavaScript Hello World"></a>JavaScript Hello World</h2><ul>
<li>   代码示例：</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="javascript"></span></span><br><span class="line"><span class="javascript">  alert(<span class="string">&#x27;Hello World&#x27;</span>);</span></span><br><span class="line"><span class="javascript"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h2 id="初识 JavaScript"><a href="# 初识 JavaScript" class="headerlink" title="初识 JavaScript"></a>初识 JavaScript</h2><blockquote>
<p>创始人 Brendan Eich<br>和 Java 完全没有关系 (和 Java 同属于 sun 公司)</p>
</blockquote>
<ul>
<li><p>JavaScript 是脚本语言</p>
</li>
<li><p>JavaScript 不需要编译器编译，由浏览器直接解释</p>
</li>
<li><p>最初是判断密码强度的</p>
</li>
<li><p>JavaScript 组成</p>
<ul>
<li>ECMAScript：JavaScript 语法</li>
<li>DOM：文档对象模型</li>
<li>BOM：浏览器对象模型</li>
</ul>
</li>
</ul>
<h3 id="JavaScript 书写位置"><a href="#JavaScript 书写位置" class="headerlink" title="JavaScript 书写位置"></a>JavaScript 书写位置</h3><ul>
<li><p>行内式 js：在标签内加入属性</p>
</li>
<li><p>内嵌式的 js：在 script 标签里写 js 代码</p>
</li>
<li><p>外部 js：新建一个 js 文件，然后用 <code>&lt;script src=&quot;xx.js&quot;&gt;&lt;/script&gt;</code> 引入</p>
<ul>
<li><span style="background-color: yellow;"> 引入外部 JS 文件时在两个标签之间不允许写代码 </span></li>
</ul>
</li>
<li><p>小知识：在 js 中推荐使用单引号</p>
</li>
</ul>
<h3 id="JavaScript 注释"><a href="#JavaScript 注释" class="headerlink" title="JavaScript 注释"></a>JavaScript 注释</h3><ul>
<li>   代码示例：</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 单行注释</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/* 多行</span></span><br><span class="line"><span class="comment">   注释 */</span></span><br></pre></td></tr></table></figure>

<ul>
<li>单行注释快捷键 Ctrl + /</li>
<li>多行注释快捷键 Shift + alt + a</li>
</ul>
<h3 id="JavaScript 输入输出语句"><a href="#JavaScript 输入输出语句" class="headerlink" title="JavaScript 输入输出语句"></a>JavaScript 输入输出语句</h3><table>
<thead>
<tr>
<th>参数值</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td>alert(‘msg’)</td>
<td>浏览器弹出警示框</td>
</tr>
<tr>
<td>console.log(‘msg’)</td>
<td>浏览器控制台打印输出消息</td>
</tr>
<tr>
<td>prompt(‘info’)</td>
<td>浏览器弹出输入框，用户可以输入</td>
</tr>
</tbody></table>
<ul>
<li>   代码示例：</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="javascript"></span></span><br><span class="line"><span class="javascript">  <span class="comment">// 输入框</span></span></span><br><span class="line"><span class="javascript">  prompt(<span class="string">&#x27; 请输入 &#x27;</span>);</span></span><br><span class="line"><span class="javascript">  <span class="comment">// 警示框</span></span></span><br><span class="line"><span class="javascript">  alert(<span class="string">&#x27; 输出为 &#x27;</span>);</span></span><br><span class="line"><span class="javascript">  <span class="comment">// 控制台输出</span></span></span><br><span class="line"><span class="javascript">  <span class="built_in">console</span>.log(<span class="string">&#x27; 程序猿才能看到 &#x27;</span>);</span></span><br><span class="line"><span class="javascript"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br></pre></td></tr></table></figure>

<ul>
<li>console.log 在 F12 里的 Console 可以看到</li>
</ul>
<h2 id="JavaScript 变量"><a href="#JavaScript 变量" class="headerlink" title="JavaScript 变量"></a>JavaScript 变量</h2><ul>
<li>变量：存储数据的容器</li>
</ul>
<h3 id="变量的使用"><a href="# 变量的使用" class="headerlink" title="变量的使用"></a>变量的使用</h3><ul>
<li>   声明变量和赋值：</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 声明一个 age 变量</span></span><br><span class="line"><span class="keyword">var</span> age;</span><br><span class="line">age = <span class="number">18</span>;</span><br><span class="line"><span class="comment">// 或者</span></span><br><span class="line"><span class="keyword">var</span> name = <span class="string">&#x27; 菜鸟小铭 &#x27;</span>;</span><br><span class="line"><span class="comment">// 声明多个变量</span></span><br><span class="line"><span class="keyword">var</span> name = <span class="string">&#x27; 菜鸟小铭 &#x27;</span> , age = <span class="string">&#x27;18&#x27;</span>;</span><br></pre></td></tr></table></figure>

<ul>
<li>var 关键字 (variable 变量) ，用来声明变量</li>
<li>声明多个变量时用逗号隔开</li>
<li>未赋值的变量默认值是 undefined<ul>
<li>未赋值直接使用会报错” xx is not defined “</li>
</ul>
</li>
<li>变量不声明可以直接使用 (前提条件必须要赋值) 不推荐</li>
</ul>
<h4 id="变量实例"><a href="# 变量实例" class="headerlink" title="变量实例"></a>变量实例</h4><ul>
<li>   让用户输入并且在页面上输出</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> myname;</span><br><span class="line">myname=prompt(<span class="string">&#x27; 请输入名字 &#x27;</span>);</span><br><span class="line">alert(<span class="string">&#x27; 欢迎您 &#x27;</span>+name);</span><br><span class="line"><span class="comment">// 可以使用 + 作为字符串连接</span></span><br></pre></td></tr></table></figure>

<h3 id="JavaScript 变量命名规范"><a href="#JavaScript 变量命名规范" class="headerlink" title="JavaScript 变量命名规范"></a>JavaScript 变量命名规范</h3><ul>
<li><p>字母数字 _ 和 $ 符号 (和 Java 命名一样)</p>
</li>
<li><p>大小写敏感</p>
</li>
<li><p>小驼峰式命名</p>
</li>
<li><p><span style="background: yellow;">不要用 name 做变量名 (因为 name 在浏览器里面有含义)</span></p>
</li>
<li><p>name 在浏览器中本身就已经被定义了</p>
</li>
</ul>
<h2 id="JavaScript 数据类型"><a href="#JavaScript 数据类型" class="headerlink" title="JavaScript 数据类型"></a>JavaScript 数据类型</h2><ul>
<li><span style="background: yellow;">JavaScript 是弱类型语言，类型在运行时会被自动确定</span></li>
<li>变量的数据类型可以变化 (例如声明一个变量等于 1，后面可以将一个字符串付给这个变量)</li>
</ul>
<h3 id="简单数据类型"><a href="# 简单数据类型" class="headerlink" title="简单数据类型"></a>简单数据类型</h3><table>
<thead>
<tr>
<th>数据类型</th>
<th>默认值</th>
</tr>
</thead>
<tbody><tr>
<td>Number(数字)</td>
<td>0</td>
</tr>
<tr>
<td>Boolean(布尔型)</td>
<td>false</td>
</tr>
<tr>
<td>String(字符串)</td>
<td>“”</td>
</tr>
<tr>
<td>Undefined(未定义的变量)</td>
<td>undefined</td>
</tr>
<tr>
<td>Null(空)</td>
<td>null</td>
</tr>
</tbody></table>
<h4 id="数字 -Number"><a href="# 数字 -Number" class="headerlink" title="数字 (Number)"></a> 数字(Number)</h4><ul>
<li><p>包括整数和小数</p>
</li>
<li><p>八进制：var num = 010; (十进制的 8) <span style="background: yellow;">程序里面数字前面加 0 表示八进制</span></p>
</li>
<li><p>十六进制：var num = 0xa; (十进制的 10) <span style="background: yellow;">程序里面数字前面加 0x 表示八进制</span></p>
<ul>
<li>.MAX_VALUE 最大值, MIN_VALUE 最小值</li>
</ul>
</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">alert(<span class="built_in">Number</span>.MAX_VALUE);<span class="comment">//1.7976931348623157e+308</span></span><br><span class="line">alert(<span class="built_in">Number</span>.MIN_VALUE);<span class="comment">//5e-324</span></span><br></pre></td></tr></table></figure>

<ul>
<li><p>infinity: 无穷大 (超过 Number 的范围)</p>
</li>
<li><p>-infinity：无穷小</p>
</li>
<li><p>NaN(Not a number)：非数值 (例如一个字符串减去一个数字)</p>
</li>
<li><p>isNAN() 判断是否为非数字，是数字返回 false，非数字返回 true</p>
</li>
</ul>
<h4 id="字符串 -String"><a href="# 字符串 -String" class="headerlink" title="字符串 (String)"></a> 字符串(String)</h4><ul>
<li>   单引号双引号皆可，推荐单引号</li>
<li>   字符串的嵌套：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> str = <span class="string">&#x27; 菜鸟 &quot; 小铭 &quot; 学习 JavaScript&#x27;</span>;</span><br></pre></td></tr></table></figure>

<ul>
<li>转义符号 “\”, 转义字符要写在引号里面</li>
</ul>
<h5 id="字符串属性"><a href="# 字符串属性" class="headerlink" title="字符串属性"></a>字符串属性</h5><ul>
<li>   检测字符串长度：length 属性</li>
<li>   代码示例：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> str = <span class="string">&#x27;noobxiaoming&#x27;</span>;</span><br><span class="line">colsole.log(str.length);</span><br></pre></td></tr></table></figure>

<ul>
<li>   字符串拼接：+</li>
<li>   + 会将所有的其他类型转换成字符串类型</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> str = <span class="string">&#x27;xiaoming&#x27;</span> , num = <span class="number">2333</span>;</span><br><span class="line">conlsole.log(str+num);</span><br><span class="line"><span class="comment">// 输出结果 xiaoming2333 (字符串型)</span></span><br></pre></td></tr></table></figure>

<h4 id="其他数据类型"><a href="# 其他数据类型" class="headerlink" title="其他数据类型"></a>其他数据类型</h4><ul>
<li><p>布尔型(Boolean)</p>
<ul>
<li>true 在参与计算时当作 1 (false 当 0)</li>
</ul>
</li>
<li><p>未定义的(undefined)</p>
<ul>
<li>没有赋初值的类型</li>
<li>undefined + 数字 = NaN</li>
<li>undefined + 字符串 = undefined 字符串</li>
</ul>
</li>
<li><p>空值(null)</p>
<ul>
<li>null + 1 = 1</li>
</ul>
</li>
</ul>
<h3 id="获取数据类型"><a href="# 获取数据类型" class="headerlink" title="获取数据类型"></a>获取数据类型</h3><ul>
<li>   关键字：typeof</li>
<li>   代码示例：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> num = <span class="number">10</span>;</span><br><span class="line"><span class="built_in">console</span>.log(<span class="keyword">typeof</span> num);</span><br></pre></td></tr></table></figure>

<ul>
<li><p> <span style="background: yellow;">在数据类型为 null 时，typeof 检测的数据为 object (对象)</span></p>
</li>
<li><p>数据类型特例：</p>
</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> age = prompt(<span class="string">&#x27; 请输入年龄 &#x27;</span>);</span><br><span class="line"><span class="comment">// 这里输入 18</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="keyword">typeof</span> age);</span><br><span class="line"><span class="comment">// 这里输出 String 类型</span></span><br></pre></td></tr></table></figure>

<ul>
<li> <span style="background: yellow;">prompt 取得的值是字符型的</span></li>
</ul>
<h4 id="通过控制台获取数据类型"><a href="# 通过控制台获取数据类型" class="headerlink" title="通过控制台获取数据类型"></a>通过控制台获取数据类型</h4><ul>
<li>数字型：蓝色</li>
<li>字符型：黑色</li>
<li>布尔型：深蓝色</li>
<li>bool 和 null：浅灰色</li>
</ul>
<h3 id="数据类型转换"><a href="# 数据类型转换" class="headerlink" title="数据类型转换"></a>数据类型转换 </h3><h4 id="转换成字符串型"><a href="# 转换成字符串型" class="headerlink" title="转换成字符串型"></a> 转换成字符串型</h4><table>
<thead>
<tr>
<th>方式</th>
<th>默认值</th>
</tr>
</thead>
<tbody><tr>
<td>.toString()</td>
<td>转换成字符串</td>
</tr>
<tr>
<td>String()</td>
<td>强制转换成字符串</td>
</tr>
<tr>
<td>+</td>
<td><strong>拼接结果为字符串(隐式转换)</strong></td>
</tr>
</tbody></table>
<ul>
<li>   代码示例：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> num = <span class="number">12</span>;</span><br><span class="line"><span class="built_in">console</span>.log(num.toString());</span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">String</span>(num));</span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">&#x27;&#x27;</span> + num);</span><br></pre></td></tr></table></figure>

<h4 id="转换成数字型"><a href="# 转换成数字型" class="headerlink" title="转换成数字型"></a>转换成数字型</h4><table>
<thead>
<tr>
<th>方式</th>
<th>默认值</th>
</tr>
</thead>
<tbody><tr>
<td>parseInt(string)</td>
<td>string 转换成 int</td>
</tr>
<tr>
<td>parseFloat(string)</td>
<td>string 转换成 float</td>
</tr>
<tr>
<td>Number()</td>
<td>强制转换成数值型</td>
</tr>
<tr>
<td>- * /</td>
<td>计算结果为数字（隐式转换）</td>
</tr>
</tbody></table>
<ul>
<li>   代码示例：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> str = <span class="string">&#x27;2020&#x27;</span>;</span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">parseInt</span>(str));</span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">parseFloat</span>(str));</span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">Number</span>(str));</span><br><span class="line"><span class="comment">// 减号方法</span></span><br><span class="line"><span class="built_in">console</span>.log(str - <span class="number">0</span>);<span class="comment">// 字符型隐式转换为数字型</span></span><br><span class="line"><span class="built_in">console</span>.log(str * <span class="number">1</span>);</span><br><span class="line"><span class="built_in">console</span>.log(str / <span class="number">1</span>);</span><br><span class="line"><span class="built_in">console</span>.log(str - <span class="string">&#x27;20&#x27;</span>);<span class="comment">// 结果为 2000</span></span><br></pre></td></tr></table></figure>

<ul>
<li>   如果字符串里后面有单位(首个必须是数字，后面可以是字母)，parseInt 和 parseFloat 会自动把单位去掉</li>
<li>   如果前后都有字母，parseInt 和 parseFloat 会返回 NaN</li>
<li>   例如：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> unit = <span class="string">&#x27;120px&#x27;</span>;</span><br><span class="line"><span class="keyword">var</span> str = <span class="string">&#x27;abc123abc&#x27;</span>;</span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">parseInt</span>(unit));</span><br><span class="line"><span class="comment">// 输出 120</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">parseInt</span>(str));</span><br><span class="line"><span class="comment">// 输出 NaN</span></span><br></pre></td></tr></table></figure>

<h4 id="布尔型转换"><a href="# 布尔型转换" class="headerlink" title="布尔型转换"></a>布尔型转换</h4><ul>
<li>   Boolean() 函数</li>
<li>   把 ‘’，0，NaN，null，undefined 为 false</li>
<li>   代码示例：</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">console</span>.log(<span class="built_in">Boolean</span>(<span class="string">&#x27;&#x27;</span>));</span><br><span class="line"><span class="comment">// 输出 false</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p>本文转载自<a target="_blank" rel="external nofollow noopener noreferrer" href="https://blog.csdn.net/weixin_46170034/article/details/104685255">https://blog.csdn.net/weixin_46170034/article/details/104685255</a></p>
</blockquote>

    </div>

    
    
    
      
  <div class="popular-posts-header">相关文章推荐</div>
  <ul class="popular-posts">
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\archives\35d65417.html" rel="bookmark">JavaScript 之 WebAPI 学习 1</a></div>
    </li>
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\archives\dbd8353b.html" rel="bookmark">JavaScript 之 WebAPI 学习 3</a></div>
    </li>
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\archives\45bca098.html" rel="bookmark">JavaScript 之 WebAPI 学习 4</a></div>
    </li>
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\archives\cf0fa0d2.html" rel="bookmark">JavaScript 基础语法 2</a></div>
    </li>
    <li class="popular-posts-item">
      <div class="popular-posts-title"><a href="\archives\acdf05ad.html" rel="bookmark">JavaScript 之 WebAPI 学习 2</a></div>
    </li>
  </ul>

        <div class="reward-container">
  <div>感谢各位打赏的小伙伴</div>
  <button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/images/wechatpay.png" alt="肥肉啊肥肉你在哪 微信支付">
        <p>微信支付</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/alipay.png" alt="肥肉啊肥肉你在哪 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>

        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>肥肉啊肥肉你在哪
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://fat_fat_where_are_you.gitee.io/archives/5606f168.html" title="JavaScript 基础语法 1">http://fat_fat_where_are_you.gitee.io/archives/5606f168.html</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noopener noreferrer" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/JavaScript/" rel="tag"><i class="fas fa-tags"></i> JavaScript</a>
          </div>

        
  <div class="post-widgets">
    <div class="wp_rating">
      <div id="wpac-rating"></div>
    </div>
  </div>


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/archives/c10fa92e.html" rel="prev" title="读《Head First HTML 与 CSS》3">
      <i class="fa fa-chevron-left"></i> 读《Head First HTML 与 CSS》3
    </a></div>
      <div class="post-nav-item">
    <a href="/archives/cf0fa0d2.html" rel="next" title="JavaScript 基础语法 2">
      JavaScript 基础语法 2 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#JavaScript%20%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95%201"><span class="nav-text">JavaScript 基础语法 1</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#JavaScript-Hello-World"><span class="nav-text">JavaScript Hello World</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%88%9D%E8%AF%86%20JavaScript"><span class="nav-text">初识 JavaScript</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#JavaScript%20%E4%B9%A6%E5%86%99%E4%BD%8D%E7%BD%AE"><span class="nav-text">JavaScript 书写位置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#JavaScript%20%E6%B3%A8%E9%87%8A"><span class="nav-text">JavaScript 注释</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#JavaScript%20%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E8%AF%AD%E5%8F%A5"><span class="nav-text">JavaScript 输入输出语句</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#JavaScript%20%E5%8F%98%E9%87%8F"><span class="nav-text">JavaScript 变量</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%98%E9%87%8F%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="nav-text">变量的使用</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%8F%98%E9%87%8F%E5%AE%9E%E4%BE%8B"><span class="nav-text">变量实例</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#JavaScript%20%E5%8F%98%E9%87%8F%E5%91%BD%E5%90%8D%E8%A7%84%E8%8C%83"><span class="nav-text">JavaScript 变量命名规范</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#JavaScript%20%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">JavaScript 数据类型</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%AE%80%E5%8D%95%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">简单数据类型</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E6%95%B0%E5%AD%97%20-Number"><span class="nav-text"> 数字(Number)</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%20-String"><span class="nav-text"> 字符串(String)</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%B1%9E%E6%80%A7"><span class="nav-text">字符串属性</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%85%B6%E4%BB%96%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">其他数据类型</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%8E%B7%E5%8F%96%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">获取数据类型</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E9%80%9A%E8%BF%87%E6%8E%A7%E5%88%B6%E5%8F%B0%E8%8E%B7%E5%8F%96%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">通过控制台获取数据类型</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2"><span class="nav-text">数据类型转换 </span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%E8%BD%AC%E6%8D%A2%E6%88%90%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%9E%8B"><span class="nav-text"> 转换成字符串型</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E8%BD%AC%E6%8D%A2%E6%88%90%E6%95%B0%E5%AD%97%E5%9E%8B"><span class="nav-text">转换成数字型</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E5%B8%83%E5%B0%94%E5%9E%8B%E8%BD%AC%E6%8D%A2"><span class="nav-text">布尔型转换</span></a></li></ol></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="肥肉啊肥肉你在哪" src="/images/touxiang.gif">
  <p class="site-author-name" itemprop="name">肥肉啊肥肉你在哪</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">38</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">16</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/feirouafeirou" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;feirouafeirou" rel="external nofollow noopener noreferrer" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="http://wpa.qq.com/msgrd?v=3&uin=1729013657&site=qq&menu=yes" title="QQ → http:&#x2F;&#x2F;wpa.qq.com&#x2F;msgrd?v&#x3D;3&amp;uin&#x3D;1729013657&amp;site&#x3D;qq&amp;menu&#x3D;yes" rel="external nofollow noopener noreferrer" target="_blank"><i class="fab fa-qq fa-fw"></i>QQ</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://www.woshipm.com/" title="http:&#x2F;&#x2F;www.woshipm.com" rel="external nofollow noopener noreferrer" target="_blank">人人都是产品经理</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://www.chanpin100.com/" title="http:&#x2F;&#x2F;www.chanpin100.com" rel="external nofollow noopener noreferrer" target="_blank">产品壹佰</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>

  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 2020 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">肥肉啊肥肉你在哪</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">237k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">3:35</span>
</div>

<div class="translate-style">
繁/简：<a id="translateLink" href="javascript:translatePage();">繁体
</a>
</div>
<script type="text/javascript" src="/js/tw_cn.js"></script>
<script type="text/javascript">
var defaultEncoding = 2; //网站编写字体是否繁体，1-繁体，2-简体
var translateDelay = 0; //延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
var cookieDomain = "https://feirouafeirou.github.io/"; //Cookie地址, 一定要设定, 通常为你的网址
var msgToTraditionalChinese = "繁体"; //此处可以更改为你想要显示的文字
var msgToSimplifiedChinese = "简体"; //同上，但两处均不建议更改
var translateButtonId = "translateLink"; //默认互换id
translateInitilization();
</script>


        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>


  



  <script>
  if (CONFIG.page.isPost) {
    wpac_init = window.wpac_init || [];
    wpac_init.push({
      widget: 'Rating',
      id    : 26171,
      el    : 'wpac-rating',
      color : 'fc6423'
    });
    (function() {
      if ('WIDGETPACK_LOADED' in window) return;
      WIDGETPACK_LOADED = true;
      var mc = document.createElement('script');
      mc.type = 'text/javascript';
      mc.async = true;
      mc.src = '//embed.widgetpack.com/widget.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling);
    })();
  }
  </script>

  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'puzQn5yHhkbtBj2VGFbqJ4FE-MdYXbMMI',
      appKey     : 'lmcgKM2surcxNxMRiqInHjkU',
      placeholder: "Just go go",
      avatar     : 'retro',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>
<div class="moon-menu">
  <div class="moon-menu-items">
    
    <div id="moon-menu-item-back2bottom" class="moon-menu-item" onclick="back2bottom()">
      <i class="fa fa-chevron-down"></i>    </div>
    
    <div id="moon-menu-item-back2top" class="moon-menu-item" onclick="back2top()">
      <i class="fa fa-chevron-up"></i>    </div>
    
  </div>
  <div class="moon-menu-button">
    <svg class="moon-menu-bg">
      <circle class="moon-menu-cricle" cx="50%" cy="50%" r="44%"/>
      <circle class="moon-menu-border" cx="50%" cy="50%" r="48%"/>
    </svg>
    <div class="moon-menu-content">
      <div class="moon-menu-icon"><i class="fas fa-ellipsis-v"></i></div>
      <div class="moon-menu-text"></div>
    </div>
  </div>
</div><script src="/js/injector.js"></script>
<!-- 数字雨 -->
<!-- <canvas id="canvas" width="1440" height="900" ></canvas> -->
<!-- <script type="text/javascript" src="/js/src/DigitalRain.js"></script> -->
<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/clicklove.js"></script>
<!--浏览器搞笑标题-->
<script type="text/javascript" src="/js/FunnyTitle.js"></script>
<!-- Live2D看板娘 -->
<!-- <script src="/live2d-widget/autoload.js"></script> -->
<!-- <script src="https://feirouafeirou.github.io/live2d-widget/autoload.js"></script> -->
<!-- 网页音乐播放器 -->
<!-- <link rel="stylesheet" href="/dist/APlayer.min.css">
<div id="aplayer"></div>
<script type="text/javascript" src="/dist/APlayer.min.js"></script>
<script type="text/javascript" src="/dist/music.js"></script> -->
</body>

</html>
